<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>其它地图操作</title>
    <link href='bundle.css' rel='stylesheet'/>
    <!-- 引入js文件 -->
    <script src="../static/js/bundle.js"></script>
    <script src="../static/js/config.js"></script>
</head>
<body>
<div id="map" style='width: 1440px; height: 500px;'></div>
<div>
    <button onclick="zoomIn()">放大</button>
    <button onclick="zoomOut()">缩小</button>
    <div>
        lat:<input id="input_lat" type="text" value="30.597505681768908">lon:
        <input id="input_lon" type="text" value="104.06029640659995">
        zoom:<input id="input_zoom" value="18">
        <button onclick="move()">移动</button>
    </div>
    <button onclick="getMapCenter()">获取屏幕中心点经纬度</button>
</div>
<script type="application/javascript">
    var vectorMap = new creeper.VectorMap('map', config.wmapId, config.mapBaseUrl);

    function zoomIn() {
        vectorMap.zoomIn();
    }

    function zoomOut() {
        vectorMap.zoomOut();
    }

    function move() {
        var lat = document.getElementById('input_lat').value;
        var lon = document.getElementById('input_lon').value;
        var zoom = document.getElementById('input_zoom').value;

        vectorMap.flyTo({
            center: [lon, lat],
            zoom: zoom
        })
    }

    function getMapCenter() {
        var center = vectorMap.getCenter();

        alert('中心点是:'+JSON.stringify(center))
    }
</script>
</body>
</html>
